package com.sdry.mapper.zc;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.sdry.model.jyy.ReceiveDetail;
import com.sdry.model.lz.Customer;
import com.sdry.model.lz.Materiel;
import com.sdry.model.lz.MaterielInStock;
import com.sdry.model.lz.Warehouse;
import com.sdry.model.lz.WarehouseRegion;
import com.sdry.model.lz.WarehouseRegionLocation;
import com.sdry.model.zc.ZcAdjustEntity;
import com.sdry.model.zc.ZcGeneralQueryEntity;
import com.sdry.model.zc.ZcInventoryInfoEntity;
import com.sdry.model.zc.ZcMaterielAndTrayEntity;

/**
 * 
 * @ClassName:    ZcInventoryManagementMapper   
 * @Description:  库存管理
 * 1.多仓库修改  t  2019-11-05
 * 165-179    通过库位码和仓库id查询库区信息
 * @Author:       zc   
 * @CreateDate:   2019年4月19日 下午7:20:34   
 * @Version:      v1.0
 */
public interface ZcInventoryManagementMapper {

	/**
	 * 查询库存列表
	 * @param zcGeneralQueryEntity
	 * @return
	 */
	public List<ZcInventoryInfoEntity> selectInventoryInfoList(ZcGeneralQueryEntity zcGeneralQueryEntity);
	/**
	 * 查询库存列表数目
	 * @param zcGeneralQueryEntity
	 * @return
	 */
	public int countInventoryInfoList(ZcGeneralQueryEntity zcGeneralQueryEntity);
	/**
	 *查询仓库列表 
	 * @param zcGeneralQueryEntity
	 * @return
	 */
	public List<Warehouse> selectAllWarehouseList(ZcGeneralQueryEntity zcGeneralQueryEntity);
	/**
	 * 通过仓库id查库区
	 * @param zcGeneralQueryEntity
	 * @return
	 */
	public List<WarehouseRegion> selectWarehouseRegionListByWarehouseId(ZcGeneralQueryEntity zcGeneralQueryEntity);
	/**
	 * 通过库区id查库位
	 * @param zcGeneralQueryEntity
	 * @return
	 */
	public List<WarehouseRegionLocation> selectWarehouseRegionLocationListByRegionId(ZcGeneralQueryEntity zcGeneralQueryEntity);
	/**
	 * 通过产品码或简码查询库存信息
	 * @param zcGeneralQueryEntity
	 * @return
	 */
	public List<ZcInventoryInfoEntity> selectInventoryInfoByCode(ZcGeneralQueryEntity zcGeneralQueryEntity);
	/**
	 * 库存调整
	 * @param zcAdjustEntity
	 * @return
	 */
	public int adjust(ZcAdjustEntity zcAdjustEntity);
	/**
	 * 库存预警
	 * @param zcInventoryInfoEntity
	 * @return
	 */
	
	public int stockWarning(ZcInventoryInfoEntity zcInventoryInfoEntity);
	/**
	 * 查询所有供应商
	 */
	public List<Customer> selectAllCustomerList(ZcGeneralQueryEntity zcGeneralQueryEntity);
	/**
	 * 移库
	 */
	public int bindingWarehouse(Materiel materiel);
	/**
	 * 通过产品码或简码查询规格型号
	 */
	public List<Materiel> selectMaterielSizeByCode(ZcGeneralQueryEntity zcGeneralQueryEntity);
	/********************************************APP****************************************/
	/**
	 * 通过仓库和库区名称查询库区id
	 * @param ware
	 * @param srcRegion
	 * @return
	 */
	public Long selectSrcRegionIdByName(@Param("ware")String ware,@Param("srcRegion")String srcRegion);
	/**
	 * 通过库区和库位名称查询库位id
	 * @param srcRegion
	 * @param srcLocation
	 * @return
	 */
	public Long selectSrcLocationIdByName(@Param("srcRegion")String srcRegion, @Param("srcLocation")String srcLocation);
	/**
	 * 查询库存预警列表
	 * @return
	 */
	public List<ZcInventoryInfoEntity> selectStockWarningList();
	/**
	 * 通过仓库名称查询id
	 * @param ware
	 * @return
	 */
	public Long selectSrcWareIdByName(String ware);
	/**
	 * 通过产品码及规格型号查询物料信息
	 * @param zcGeneralQueryEntity
	 * @return
	 */
	public Materiel selectMaterielInfoByCodeApp(ZcGeneralQueryEntity zcGeneralQueryEntity);
	/**
	 * 查询库存信息详情
	 * @param zcGeneralQueryEntity
	 * @return
	 */
	public List<ZcMaterielAndTrayEntity> selectInventoryInfoListDetails(ZcGeneralQueryEntity zcGeneralQueryEntity);
	/**
	 * 查询库存信息详情数量
	 * @param zcGeneralQueryEntity
	 * @return
	 */
	public int countInventoryInfoListDetails(ZcGeneralQueryEntity zcGeneralQueryEntity);
	/**
	 * 查询托盘所在库位
	 * @param tray_code
	 * @return
	 */
	public String selectLocationCode(String tray_code);
	
	/**
	 * 通过产品码或简码查询物料规格型号信息2
	 * @param response
	 * @param mcode 产品码或简码
	 * @param specification 物料规格型号String materiel_size, String materiel_properties
	 */
	public List<MaterielInStock> queryMaterielBatchByMcodeSpecification(@Param("mcode")String mcode, @Param("materiel_size")String materiel_size, @Param("materiel_properties")String materiel_properties);
	
	/**
	 * 根据物料ID去收货详细表查询
	 * @param id 物料id
	 * @return
	 */
	public List<ReceiveDetail> queryReceiveDetailByMaterielId(Long mid);
	/**
	 * 查询物料是否绑定了库位
	 * @param id
	 * @return
	 */
	public int selectBindByMid(Long id);
	/* ******************************多仓库修改  t  2019-11-05 开始*************************** */
	/**
	 * 通过库位码和仓库id查询库区信息
	 * @param location_code 库位码
	 * @param warehouse_id 仓库id
	 * @return
	 */
	public WarehouseRegion selectRegionByLocationCode(@Param("location_code")String location_code,@Param("warehouse_id")Long warehouse_id);
	/** 多仓库修改之前：
	 * 通过库位码查询库区信息
	 * @param location_code
	 * @return
	 *//*
	public WarehouseRegion selectRegionByLocationCode(String location_code);*/
	/* ******************************多仓库修改  t  2019-11-05 结束*************************** */
	/**
	 * 查询精简库存列表
	 * @param zcGeneralQueryEntity
	 * @return
	 */
	public List<ZcInventoryInfoEntity> selectInventoryInfoOnlyCountList(ZcGeneralQueryEntity zcGeneralQueryEntity);
	/**
	 * 查询精简库存数量
	 * @param zcGeneralQueryEntity
	 * @return
	 */
	public Integer countInventoryInfoOnlyCountList(ZcGeneralQueryEntity zcGeneralQueryEntity);
	/**   
	 * 分页查询精简库存  
	 * @param materiel
	 * @return             
	 */
	public List<ZcInventoryInfoEntity> selectInventoryInfoListDetailsFromLian(Materiel materiel);
	/**   
	 * 统计精简库存的行数  
	 * @param materiel
	 * @return             
	 */
	public int countInventoryInfoOnlyCountListFromLian(Materiel materiel);
}